package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/22 18:22
 **/
public class Offer53_Ⅱ {
    class Solution {
        public int missingNumber(int[] nums) {
            int l = 0, r = nums.length-1, mid;
            while(l < r){
                mid = l + ((r-l) >> 1);
                if(nums[mid] == mid) l = mid + 1;
                else r = mid;
            }
            return l == nums.length-1 && nums[l] == l ? l + 1 : l;
        }
    }
}